package com.you.atlas.web.member.module;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.Navigator;
import com.you.member.biz.service.MemberQueryService;
import com.you.member.dal.dao.dataobject.MemberDO;

public abstract class MemberModule {

    @Autowired
    private MemberQueryService memberQueryService;

    public boolean checkAuth(Long memberId, Navigator navigator, Context context) {

        MemberDO memberDO = memberQueryService.find(memberId);
        if (memberDO == null) {
            navigator.redirectTo("memberModule").withTarget("error.vm");
            return false;
        } else {
            context.put("memberDO", memberDO);
            return true;
        }
    }
}
